<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>课程列表</title>
</head>
<body>
    <form action="getCourse">
        <input type="text" name="name" placeholder="请输入课程名">
        <input type="submit" value="查询">
    </form>
    <a href="addCourse.jsp">添加课程</a>
<table border="1">
    <tr>
        <th>课程名</th>
        <th>课程人数</th>
        <th>开始时间</th>
        <th>结束时间</th>
        <th>教师</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${courseList}" var="course">
        <tr>
            <td>${course.name}</td>
            <td>${course.count}</td>
            <td>${course.startDate}</td>
            <td>${course.endDate}</td>
            <td>${course.teacher}</td>
            <td>
               <a href="javascript:deleteCourseById(${course.id})">删除</a>
            </td>
        </tr>
    </c:forEach>
</table>
    <p>${msg}</p>
    <script>
        function deleteCourseById(id) {
            if (confirm("确定删除吗？")){
                location.href = "deleteCourseById?id=" + id;
            }
        }
    </script>
</body>
</html>
